package com.guli.gulimall.product.web.controller;

import com.guli.gulimall.product.entity.CategoryEntity;
import com.guli.gulimall.product.service.CategoryService;
import com.guli.gulimall.product.vo.Category2Vo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * @author DELL
 * #Description IndexController
 * #Date: 2022/3/9 19:35
 */
@Controller
public class IndexController {

    @Autowired
    private CategoryService categoryService;

    @RequestMapping(value = {"/","/index.html"})
    public String index(Model model){

        List<CategoryEntity> l1List=categoryService.getL1List();
        model.addAttribute("l1list",l1List);

        return "index";
    }
    @RequestMapping(value = {"/findCatalog"})
    @ResponseBody
    public Map<Long,List<Category2Vo>> findCatalog(){

        Map<Long,List<Category2Vo>> map=categoryService.findCatelog();

        return map;
    }






}
